<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2019/5/10
 * Time: 21:46
 */

namespace app\admin\controller;

use think\Controller;
use app\admin\model\User;
use think\facade\Session;

class Member extends Base
{
    public function memberList(){
        return $this->fetch();
    }
    public function memberData($page,$limit){
        $where = input('get.where')?[['nickname|true_name|phone|id','like','%'.trim(input('get.where')).'%']]:'';
        $data = User::where($where)->page($page,$limit)->field('openid',true)->select()->toArray();
        foreach($data as $k=>$v){
            $data[$k]['create_time']=date('Y-m-d H:i:s',$v['create_time']);
        }
        $count = User::where($where)->count();
        $result = [
            'code'=>0,
            'msg'=>'返回成功',
            'count'=>$count,
            'data'=>$data
        ];
        return json($result);
    }

}